<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="lianxi.css">
</head>
<body>
      <div class="box">
           <h2>登录</h2>
           <div class="center">
            <input type="text" placeholder="请输入手机号" class="i1 i2">
            <input type="password" placeholder="请输入密码" class="i1 i3">
            <input type="checkbox" id="login">自动登录
            <a href="" class="forget">忘记密码</a>
            <button class="btn">登录</button>
           </div>
          <div id="bottom1">
          <span style="margin-left: 20px;" class="s1"> <a href="">< &nbsp;其他登录方式</a></span>
          <span style="margin-left: 280px;" class="s2"><a href="">没有账号？免费注册</a></span>
          </div>
      </div>
      <script>
        var btn=document.getElementsByClassName("btn")[0]
        btn.onclick=function(){
        var phone=document.getElementsByClassName("i2")[0].value*1
        var pws=document.getElementsByClassName("i3")[0].value
        console.log(phone,pws)
          var xhr=new XMLHttpRequest()
          xhr.open("POST","https://autumnfish.cn/login/cellphone")
          var data=`phone=${phone}&password=${pws}`
          xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
          xhr.send(data)
          xhr.onreadystatechange=function(){
              if(xhr.readyState===4&&xhr.status===200){
                  console.log(xhr.responseText)
                  alert("hahahah")
              }
          }
          }
      </script>
</body>
</html>